VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "TestNotificationPublisher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit

Private mPublisher As NotificationPublisher
Private mSequenceLog As String

Public Sub testOnce()
givenNotificationPub
whenMethodsCalled
thenSequenceIs "p.c.m.f.r.F.M.C.P"
End Sub
Public Sub testTwice()
givenNotificationPub2
whenMethodsCalled
thenSequenceIs "p.p.c.c.m.m.f.f.r.r.F.F.M.M.C.C.P.P"
End Sub

''
Private Sub givenNotificationPub()
Set mPublisher = New NotificationPublisher
mPublisher.Add Me
End Sub
Private Sub givenNotificationPub2()
Set mPublisher = New NotificationPublisher
mPublisher.Add Me
mPublisher.Add Me
End Sub

Private Sub whenMethodsCalled()
mPublisher.StartProject New ProjectFixture
mPublisher.StartClass New ClassFixture
mPublisher.StartMethod New MethodFixture
mPublisher.StartFineMethod New FineMethodCaller
mPublisher.testResult True, Me, Me, "", "r"
mPublisher.EndFineMethod
mPublisher.EndMethod
mPublisher.EndClass
mPublisher.EndProject
End Sub

Private Sub thenSequenceIs(sequence As String)
assert.equals mSequenceLog, sequence
End Sub

''
'Notification self shunt
Public Sub StartProject(project As ProjectFixture)
Add "p"
End Sub
Public Sub StartClass(Class As ClassFixture)
Add "c"
End Sub
Public Sub StartMethod(method As MethodFixture)
Add "m"
End Sub
Public Sub StartFineMethod(method As FineMethodCaller)
Add "f"
End Sub
Public Sub testResult(result As Boolean, actual As Variant, expected As Variant, tagMessage As String, fullDescription As String)
Add fullDescription
End Sub
Public Sub EndFineMethod()
Add "F"
End Sub
Public Sub EndMethod()
Add "M"
End Sub
Public Sub EndClass()
Add "C"
End Sub
Public Sub EndProject()
Add "P"
End Sub

'' Logger
Public Sub Add(name As String)
If Len(mSequenceLog) = 0 Then
    mSequenceLog = name
Else
    mSequenceLog = mSequenceLog + "." + name
End If
End Sub

'OPTIONAL METHODS
Public Sub setup()
mSequenceLog = ""
End Sub

Public Function NumOfAsserts() As Long
NumOfAsserts = 2
End Function

